/**
 * Created by 恒翔联想电脑 on 2017/12/7.
 */
		function go(no){
			
			//将要跳转的页码存入表单隐藏域中
			$('#no').val(no);
			//提交表单
			$('#form1').trigger('submit');
		}


$(function () {
    $('#form1>li').click(function () {
        $(this).css('color','#5079d9');
        $(this).siblings().css('color','#000');
        var hao = $(this).children('a').text();
        if(hao == "综合排序"){
            $('#paixu').val(" and 1=1");
        }else if(hao == "销量排序"){
            $('#paixu').val(" order by xiaoliang desc");
        }else if(hao == "价格低到高"){
            $('#paixu').val(" order by money");
        }else if(hao == "价格高到低"){
            $('#paixu').val(" order by money desc");
        }
        $('#form1').trigger('submit');
        
    })
    $("#fenlei>li").click(function(){
    	$(this).css('color','#5079d9');
        $(this).siblings().css('color','#000');
        var fen = $(this).children('span').text();
        $("#yfenlei").val(fen);
        $('#form1').trigger('submit');
    })
	
    $('.ul>li').mouseenter(function () {
        $(this).children('div').css('display','block')
         // $(this).css('box-shadow','0 0 50px #C1C1C1 ')
        $(this).children('p:last').css('color','#fff')
        $(this).css('z-index','6')
    })
    $('.ul>li').mouseleave(function () {
        $(this).children('div').css('display','none')
        $(this).css('box-shadow','0 0 0px #fff inset')
        $(this).children('p:last').css('color','red')
        $(this).css('z-index','0')
    })
    
    
    
    
    
    var hao = []
    $('.yinchang').click(function () {
        var lidom = $(this).parent('li');
        var jia = {};
        jia.img = lidom.children('img').attr('src');
        jia.ming = lidom.children('p').first().text();
        var s = lidom.children('p').last().text();
        var img = lidom.children('img').attr('src');
        var ming = lidom.children('p').first().text();
        var qian = s.substring(1,s.length);
        
        var jian = lidom.children('p').last().prev().text();
        $(document).load("gouwuche.do",{"tu":img,"ming":ming,"zhi":jian,"qian":qian},function(result){
        	if(result==1){
        		 window.location.href ="denglu.jsp";
        	}else{
        		$("#yuan9").text(result);
            	$("#yuan8").text(result);
        	}
        	
        })
        
        jia.qian = s.substring(1,s.length);
        jia.shuliang = 1;
        if(hao.length<=0){
            hao.push(jia);
        }else{
            for(var i = 0;i<hao.length;i++){
                if(hao[i].ming == jia.ming){
                    hao[i].shuliang+=1;
                    break;
                }
                if(i==hao.length-1){
                    hao.push(jia);
                    break;
                }
            }
        }
    })
    $('#tu2').hide()
    $('.fanding').mouseenter(function () {
        $('#tu2').fadeIn(500)
    }).mouseleave(function () {
        $('#tu2').fadeOut(500)
    })
    $('.fanding').click(function () {
        $('body,html').animate({scrollTop:0},500)
    })
    $('.fanding').hide()
    $(document).scroll(function () {
        var fangda = $(document).scrollTop();
        if (fangda>600) {
            $('.fanding').fadeIn(1000)
        } else if (fangda <= 600) {
            $('.fanding').fadeOut(1000)
        }
    });
    $('.ban').hide()
    $(document).scroll(function () {
        var fangda = $(document).scrollTop();
        if (fangda > 160) {
            $('.ban').slideDown(500);
        } else if (fangda <= 160) {
            $(".ban").slideUp(500);
        }
    });
    $('#tu2').hide()
    $('.fanding').mouseenter(function () {
        $('#tu2').fadeIn(500)
    }).mouseleave(function () {
        $('#tu2').fadeOut(500)
    })
    $('.fanding').click(function () {
        $('body,html').animate({scrollTop:0},500)
    })
    $('.fanding').hide()
    $(document).scroll(function () {
        var fangda = $(document).scrollTop();
        if (fangda>600) {
            $('.fanding').fadeIn(1000)
        } else if (fangda <= 600) {
            $('.fanding').fadeOut(1000)
        }
    });

})
